package com.ytjj.qmyx.supplychain.api.controller;


import com.ytjj.qmyx.supplychain.common.api.CommonResult;
import com.ytjj.qmyx.supplychain.common.model.request.SalesStatisticalRequest;
import com.ytjj.qmyx.supplychain.service.ProductStatisticalService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * 商品统计管理
 */
@RestController
@RequestMapping("/productStatistical")
@Slf4j
public class ProductStatisticalController {

    @Resource
    private ProductStatisticalService productStatisticalService;

    /**
     * 总览数据（顶部）
     * @return
     */
    @GetMapping("/getHead")
    public CommonResult getHead(){
        return productStatisticalService.getHead();
    }

    /**
     * 一级类目销售统计
     */
    @PostMapping("/statisticalByTopCategory")
    public CommonResult statisticalByTopCategory(@RequestBody SalesStatisticalRequest request){
        return productStatisticalService.statisticalByTopCategory(request);
    }

    /**
     * 商品销售统计
     */
    @PostMapping("/statisticalByProduct")
    public CommonResult statisticalByProduct(@RequestBody SalesStatisticalRequest request){
        return productStatisticalService.statisticalByProduct(request);
    }
}
